module.exports = async (ctx, next) => {
  try {
    await next();
  } catch (error) {
    console.log(error);
    console.log(error.status);
    if (401 === +error.status) {
      ctx.body = {
        code: 50001,
        message: '用户鉴权失败',
      };
    }else{
      ctx.body = {
        code: '500',
        msg: '服务器未知错误'
      }
    }
  }
}
